﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the Microsoft Public License (Ms-PL).
// See accompanying file License.txt or copy at http://mews.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Mews.Net.Nntp
{
    /// <summary>Represents a LIST ACTIVE command to be sent to an NNTP server, see
    /// <a href="http://www.ietf.org/rfc/rfc3977.txt">RFC 3977</a> 7.6.3.</summary>
    /// <remarks>For compatibility with servers implementing <a href="http://www.ietf.org/rfc/rfc977.txt">RFC 977</a>,
    /// the command actually sent is LIST.</remarks>
    /// <threadsafety static="true" instance="false"/>
    public sealed class ListActiveCommand : SingleLineCommand<ListActiveResponse>
    {
        private static readonly string[] successResponseCodes = { "215" };

        /// <summary>Initializes a new instance of the <see cref="ListActiveCommand"/> class.</summary>
        public ListActiveCommand() :
            base("LIST", 2, successResponseCodes) // LIST is equivalent to LIST ACTIVE (and supported by RFC977 servers)
        {
        }

        /// <summary>See <see cref="SingleLineCommandBase{T, U}.CreateResponse"/>.</summary>
        protected sealed override ListActiveResponse CreateResponse(ResponseStream responseStream)
        {
            return new ListActiveResponse(responseStream);
        }
    }
}
